// 课堂练习1
class Point(xc: Int, yc: Int) {
   var x: Int = xc
   var y: Int = yc
   def move(dx: Int, dy: Int) {
      x = x + dx
      y = y + dy
      println ("x : " + x);
      println ("y : " + y);
   }
}
class Location(val xc: Int, val yc: Int,
   val zc :Int) extends Point(xc, yc){
   var z: Int = zc
   override def move(dx: Int, dy: Int) {
      x = x + dx + 100
      y = y + dy + 100
      println ("x location  : " + x);
      println ("y location : " + y);
   }  
   def move(dx: Int, dy: Int, dz: Int) {
      x = x + dx
      y = y + dy
      z = z + dz
      println ("x   : " + x);
      println ("y   : " + y);
      println ("z   : " + z);
   }
}
object Test {
   def main(args: Array[String]) {
      val loc = new Location(10, 20, 15);

      loc.move(10, 10);
   }
}

//课堂练习2
abstract class WSN{
  val name:String
  val age:Int
  val s:String="敲代码"
  def str():String
  
}
 
class wsn extends WSN
{  
  val name:String="吴帅男";
  val age=20;  
  def str():String="spark";
  override val s:String="敲代码"
  override def toString="学习spark";
}
object wsn
{
  def main(args: Array[String]): Unit = {
    var wsn=new wsn();
     
   println(wsn.name)
   println(wsn.age)
   println(wsn.str())
   println(wsn.s)
   println(wsn.toString)
  }
}